package com.bjbn.util;

import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;

/**
 * XML处理工具类
 */
@Slf4j
public class XmlHandle {

    public static List<Map<String, String>> handleMeteorologicalData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportMeteorologicalDataInfoSrvRequest");
            Element collection = request.element("ImportMeteorologicalDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();
                object.put("ID", inputItem.element("ID").getText());
                object.put("WEATHER", inputItem.element("WEATHER").getText());
                object.put("WIND_SPEED", inputItem.element("WIND_SPEED").getText());
                object.put("VISIBILITY", inputItem.element("VISIBILITY").getText());
                object.put("TIME", inputItem.element("TIME").getText());
                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    private static final Cache<String, String> cache = Caffeine.newBuilder()
            .expireAfterAccess(10, TimeUnit.MINUTES)
            .build();

    public static List<Map<String, String>> handleADSBData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportADSBDataInfoSrvRequest");
            Element collection = request.element("ImportADSBDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("ADDRESS_CODE", inputItem.element("ADDRESS_CODE").getText());
                object.put("LONGITUDE", inputItem.element("LONGITUDE").getText());
                object.put("LAT", inputItem.element("LAT").getText());
                object.put("HEIGHT", inputItem.element("HEIGHT").getText());
                object.put("SPEED", inputItem.element("SPEED").getText());
                object.put("ANGLE", inputItem.element("ANGLE").getText());
                object.put("SPEED_VERTICAL", inputItem.element("SPEED_VERTICAL").getText());
                object.put("FLIGHT_NO", inputItem.element("FLIGHT_NO").getText());
                object.put("FLIGHT_MODEL", inputItem.element("FLIGHT_MODEL").getText());
                object.put("FLIGHT_REG", inputItem.element("FLIGHT_REG").getText());
                object.put("FLIGHT_DEPCODE", inputItem.element("FLIGHT_DEPCODE").getText());
                object.put("FLIGHT_ARRCODE", inputItem.element("FLIGHT_ARRCODE").getText());
                object.put("TIME", inputItem.element("TIME").getText());

                String time = (String) cache.getIfPresent(object.get("FLIGHT_NO"));
                if (time != null && time.equals(object.get("TIME"))) {
                    continue;
                } else {
                    cache.put(object.get("FLIGHT_NO"), object.get("TIME"));
                }

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleDfStandData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDfStandDataInfoSrvRequest");
            Element collection = request.element("ImportDfStandDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("FLIGHTID", inputItem.element("FLIGHTID").getText());
                object.put("RESOURCEID", inputItem.element("RESOURCEID").getText());
                object.put("SCHESTARTTIME", inputItem.element("SCHESTARTTIME").getText());
                object.put("SCHEENDTIME", inputItem.element("SCHEENDTIME").getText());
                object.put("ACTLSTARTTIME", inputItem.element("ACTLSTARTTIME").getText());
                object.put("ACTLENDTIME", inputItem.element("ACTLENDTIME").getText());
                object.put("ORDERCODE", inputItem.element("ORDERCODE").getText());
                object.put("WEIGHT", inputItem.element("WEIGHT").getText());
                object.put("RULENAME", inputItem.element("RULENAME").getText());
                object.put("ISCONFIRM", inputItem.element("ISCONFIRM").getText());
                object.put("ISLOCK", inputItem.element("ISLOCK").getText());
                object.put("OPAICAOCD", inputItem.element("OPAICAOCD").getText());
                object.put("UPDATE_TIME", inputItem.element("UPDATE_TIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleBsStandData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportBsStandDataInfoSrvRequest");
            Element collection = request.element("ImportBsStandDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("ISREMOTEAPRON", inputItem.element("ISREMOTEAPRON").getText());
                object.put("MAXCRAFTTYPE", inputItem.element("MAXCRAFTTYPE").getText());
                object.put("LENGTH", inputItem.element("LENGTH").getText());
                object.put("WIDTH", inputItem.element("WIDTH").getText());
                object.put("ISOPEN", inputItem.element("ISOPEN").getText());
                object.put("OPAICAOCD", inputItem.element("OPAICAOCD").getText());
                object.put("DESCRIPTION", inputItem.element("DESCRIPTION").getText());
                object.put("DELETED", inputItem.element("DELETED").getText());
                object.put("AREA", inputItem.element("AREA").getText());
                object.put("DEICING", inputItem.element("DEICING").getText());
                object.put("WEIGHT", inputItem.element("WEIGHT").getText());
                object.put("XPOINT", inputItem.element("XPOINT").getText());
                object.put("YPOINT", inputItem.element("YPOINT").getText());
                object.put("ANGEL", inputItem.element("ANGEL").getText());
                object.put("BRIDGETYPEID", inputItem.element("BRIDGETYPEID").getText());
                object.put("ISSELFSLIP", inputItem.element("ISSELFSLIP").getText());
                object.put("STANDAREAID", inputItem.element("STANDAREAID").getText());
                object.put("STANDTYPEID", inputItem.element("STANDTYPEID").getText());
                object.put("STANDSPECIALTYPEID", inputItem.element("STANDSPECIALTYPEID").getText());
                object.put("MAJORSTANDID", inputItem.element("MAJORSTANDID").getText());
                object.put("MAXAIRPLANETYPE", inputItem.element("MAXAIRPLANETYPE").getText());
                object.put("ISSTATISTIC", inputItem.element("ISSTATISTIC").getText());
                object.put("GROUNDANCHOR", inputItem.element("GROUNDANCHOR").getText());
                object.put("TERMINAL", inputItem.element("TERMINAL").getText());
                object.put("ISAUTOALLOCATE", inputItem.element("ISAUTOALLOCATE").getText());
                object.put("MAJORSTANDCODE", inputItem.element("MAJORSTANDCODE").getText());
                object.put("MAJORSTANDID2", inputItem.element("MAJORSTANDID2").getText());
                object.put("MAJORSTANDCODE2", inputItem.element("MAJORSTANDCODE2").getText());
                object.put("CHILDRENSTANDCODES", inputItem.element("CHILDRENSTANDCODES").getText());
                object.put("ORDERCODE", inputItem.element("ORDERCODE").getText());
                object.put("SWITCHSTAND", inputItem.element("SWITCHSTAND").getText());
                object.put("UPDATE_TIME", inputItem.element("UPDATE_TIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleFzVehicleData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportFzVehicleDataInfoSrvRequest");
            Element collection = request.element("ImportFzVehicleDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("license_plate", inputItem.element("license_plate").getText());
                object.put("brand", inputItem.element("brand").getText());
                object.put("company", inputItem.element("company").getText());
                object.put("apply_company", inputItem.element("apply_company").getText());
                object.put("model", inputItem.element("model").getText());
                object.put("color", inputItem.element("color").getText());
                object.put("vehicle_category", inputItem.element("vehicle_category").getText());
                object.put("id_type", inputItem.element("id_type").getText());
                object.put("begin_time", inputItem.element("begin_time").getText());
                object.put("end_time", inputItem.element("end_time").getText());
                object.put("passage_authority", inputItem.element("passage_authority").getText());
                object.put("passage_region", inputItem.element("passage_region").getText());
                object.put("card_no", inputItem.element("card_no").getText());
                object.put("project", inputItem.element("project").getText());
                object.put("lead_car", inputItem.element("lead_car").getText());
                object.put("lead_person", inputItem.element("lead_person").getText());
                object.put("area", inputItem.element("area").getText());
                object.put("create_time", inputItem.element("create_time").getText());
                object.put("update_time", inputItem.element("update_time").getText());
                object.put("create_user", inputItem.element("create_user").getText());
                object.put("update_user", inputItem.element("update_user").getText());
                object.put("avg_upload_time", inputItem.element("avg_upload_time").getText());


                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleApronRadarData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportApronRadarDataInfoSrvRequest");
            Element collection = request.element("ImportApronRadarDataInfoSrvInputCollection");
            List<Element> items = collection.elements();

            Map<String, List<Map<String, String>>> map = new HashMap<>();

            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("id", inputItem.element("id").getText());
                object.put("acid", inputItem.element("acid").getText());
                object.put("rwy", inputItem.element("rwy").getText());
                object.put("bay", inputItem.element("bay").getText());
                object.put("latitude", inputItem.element("latitude").getText());
                object.put("longitude", inputItem.element("longitude").getText());
                object.put("altitude", inputItem.element("altitude").getText());
                object.put("type", inputItem.element("type").getText());
                object.put("status", inputItem.element("status").getText());
                object.put("target_type", inputItem.element("target_type").getText());
                object.put("dep", inputItem.element("dep").getText());
                object.put("dest", inputItem.element("dest").getText());
                object.put("speed", inputItem.element("speed").getText());
                object.put("angle", inputItem.element("angle").getText());
                object.put("time", inputItem.element("time").getText());
                object.put("remove_flag", inputItem.element("remove_flag").getText());
                object.put("del_flag", inputItem.element("del_flag").getText());
                object.put("create_by", inputItem.element("create_by").getText());
                object.put("create_time", inputItem.element("create_time").getText());
                object.put("update_by", inputItem.element("update_by").getText());
                object.put("update_time", inputItem.element("update_time").getText());
                object.put("in_rwy", inputItem.element("in_rwy").getText());


                String time = inputItem.element("time").getText();

                if (time != null && !time.isEmpty()) {
                    long timestamp = Long.parseLong(time);
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String formattedDate = sdf.format(new Date(timestamp));
                    object.put("time", formattedDate);
                }

                // 如果当前数据acid和time与lst中的数据重复，则不推送
                if (lst.stream().anyMatch(o -> o.get("acid").equals(object.get("acid")) && o.get("time").equals(object.get("time")))) {
                    continue;
                }

                if (map.containsKey(object.get("acid"))) {
                    List<Map<String, String>> list = map.get(object.get("acid"));
                    list.add(object);
                } else {
                    List<Map<String, String>> list = new ArrayList<>();
                    list.add(object);
                    map.put(object.get("acid"), list);
                }

                lst.add(object);
            }

            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleFzLocationData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportFzLocationDataInfoSrvRequest");
            Element collection = request.element("ImportFzLocationDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("id", inputItem.element("id").getText());
                object.put("vehicle_plate", inputItem.element("vehicle_plate").getText());
                object.put("alarm_sign", inputItem.element("alarm_sign").getText());
                object.put("state", inputItem.element("state").getText());
                object.put("longitude", inputItem.element("longitude").getText());
                object.put("latitude", inputItem.element("latitude").getText());
                object.put("latlng", inputItem.element("latlng").getText());
                object.put("altitude", inputItem.element("altitude").getText());
                object.put("location_speed", inputItem.element("location_speed").getText());
                object.put("direction", inputItem.element("direction").getText());
                object.put("location_time", inputItem.element("location_time").getText());
                object.put("attach_flag", inputItem.element("attach_flag").getText());
                object.put("mileage", inputItem.element("mileage").getText());
                object.put("oil", inputItem.element("oil").getText());
                object.put("pulse_speed", inputItem.element("pulse_speed").getText());
                object.put("in_fz", inputItem.element("in_fz").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleBaseAirportData(String data) {

        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportBaseAirportDataInfoSrvRequest");
            Element collection = request.element("ImportBaseAirportDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("FRCD", inputItem.element("FRCD").getText());
                object.put("APAT", inputItem.element("APAT").getText());
                object.put("CNNM", inputItem.element("CNNM").getText());
                String ennm = inputItem.element("ENNM").getText();

                // 判断字符串是否为空，并且包含单引号，如果单引号未转义则转义防止sql语句报错。
                if (ennm != null && ennm.contains("'") && !ennm.contains("''")) {
                    ennm = ennm.replace("'", "''");
                    object.put("ENNM", ennm);
                }

                object.put("ENNM", inputItem.element("ENNM").getText());
                object.put("AISO", inputItem.element("AISO").getText());
                object.put("APSN", inputItem.element("APSN").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleBaseAirstandData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportBaseAirstandDataInfoSrvRequest");
            Element collection = request.element("ImportBaseAirstandDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("CNNM", inputItem.element("CNNM").getText());
                object.put("ENNM", inputItem.element("ENNM").getText());
                object.put("REMT", inputItem.element("REMT").getText());
                object.put("TMLC", inputItem.element("TMLC").getText());
                object.put("STUS", inputItem.element("STUS").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleBaseAirtaskData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportBaseAirtaskDataInfoSrvRequest");
            Element collection = request.element("ImportBaseAirtaskDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("CNNM", inputItem.element("CNNM").getText());
                object.put("ENNM", inputItem.element("ENNM").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleBaseAirwayData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportBaseAirwayDataInfoSrvRequest");
            Element collection = request.element("ImportBaseAirwayDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("TRCD", inputItem.element("TRCD").getText());
                object.put("ALAT", inputItem.element("ALAT").getText());
                object.put("CNNM", inputItem.element("CNNM").getText());
                object.put("ENNM", inputItem.element("ENNM").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleDFltairlineData(String data) {

        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltairlineDataInfoSrvRequest");
            Element collection = request.element("ImportDFltairlineDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("APNO", inputItem.element("APNO").getText());
                object.put("APCD", inputItem.element("APCD").getText());
                object.put("FPTT", inputItem.element("FPTT").getText());
                object.put("FETT", inputItem.element("FETT").getText());
                object.put("FRTT", inputItem.element("FRTT").getText());
                object.put("FPLT", inputItem.element("FPLT").getText());
                object.put("FELT", inputItem.element("FELT").getText());
                object.put("FRLT", inputItem.element("FRLT").getText());
                object.put("APAT", inputItem.element("APAT").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleDFltcounterData(String data) {

        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltcounterDataInfoSrvRequest");
            Element collection = request.element("ImportDFltcounterDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("CKNO", inputItem.element("CKNO").getText());
                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("CKAT", inputItem.element("CKAT").getText());
                object.put("TYPE", inputItem.element("TYPE").getText());
                object.put("CCAR", inputItem.element("CCAR").getText());
                object.put("ESTR", inputItem.element("ESTR").getText());
                object.put("EEND", inputItem.element("EEND").getText());
                object.put("RSTR", inputItem.element("RSTR").getText());
                object.put("REND", inputItem.element("REND").getText());
                object.put("BTSC", inputItem.element("BTSC").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleDFltgateData(String data) {

        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltgateDataInfoSrvRequest");
            Element collection = request.element("ImportDFltgateDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("GTNO", inputItem.element("GTNO").getText());
                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("GTAT", inputItem.element("GTAT").getText());
                object.put("ESTR", inputItem.element("ESTR").getText());
                object.put("EEND", inputItem.element("EEND").getText());
                object.put("RSTR", inputItem.element("RSTR").getText());
                object.put("REND", inputItem.element("REND").getText());
                object.put("BTSC", inputItem.element("BTSC").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleDFltinfoData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltinfoDataInfoSrvRequest");
            Element collection = request.element("ImportDFltinfoDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("AFID", inputItem.element("AFID").getText());
                object.put("FFID", inputItem.element("FFID").getText());
                object.put("AWCD", inputItem.element("AWCD").getText());
                object.put("FLNO", inputItem.element("FLNO").getText());
                object.put("FEXD", inputItem.element("FEXD").getText());
                object.put("FIMD", inputItem.element("FIMD").getText());
                object.put("FLIO", inputItem.element("FLIO").getText());
                object.put("FLTK", inputItem.element("FLTK").getText());
                object.put("FATT", inputItem.element("FATT").getText());
                object.put("PATT", inputItem.element("PATT").getText());
                object.put("MFID", inputItem.element("MFID").getText());
                object.put("MFFI", inputItem.element("MFFI").getText());
                object.put("CONT", inputItem.element("CONT").getText());
                object.put("PROX", inputItem.element("PROX").getText());
                object.put("CFTP", inputItem.element("CFTP").getText());
                object.put("CFNO", inputItem.element("CFNO").getText());
                object.put("STAT", inputItem.element("STAT").getText());
                object.put("ABST", inputItem.element("ABST").getText());
                object.put("ISTA", inputItem.element("ISTA").getText());
                object.put("IAST", inputItem.element("IAST").getText());
                object.put("MSTA", inputItem.element("MSTA").getText());
                object.put("MIST", inputItem.element("MIST").getText());
                object.put("MABS", inputItem.element("MABS").getText());
                object.put("MIAS", inputItem.element("MIAS").getText());
                object.put("MABR", inputItem.element("MABR").getText());
                object.put("MIAR", inputItem.element("MIAR").getText());
                object.put("IARS", inputItem.element("IARS").getText());
                object.put("ABRS", inputItem.element("ABRS").getText());
                object.put("BORT", inputItem.element("BORT").getText());
                object.put("MBOR", inputItem.element("MBOR").getText());
                object.put("TBRT", inputItem.element("TBRT").getText());
                object.put("MTBR", inputItem.element("MTBR").getText());
                object.put("LBDT", inputItem.element("LBDT").getText());
                object.put("MLBD", inputItem.element("MLBD").getText());
                object.put("POKT", inputItem.element("POKT").getText());
                object.put("MPOK", inputItem.element("MPOK").getText());
                object.put("APOT", inputItem.element("APOT").getText());
                object.put("DETT", inputItem.element("DETT").getText());
                object.put("DRTT", inputItem.element("DRTT").getText());
                object.put("DELT", inputItem.element("DELT").getText());
                object.put("DRLT", inputItem.element("DRLT").getText());
                object.put("VIP", inputItem.element("VIP").getText());
                object.put("PAST", inputItem.element("PAST").getText());
                object.put("FCES", inputItem.element("FCES").getText());
                object.put("FCEE", inputItem.element("FCEE").getText());
                object.put("FCRS", inputItem.element("FCRS").getText());
                object.put("FCRE", inputItem.element("FCRE").getText());
                object.put("MCES", inputItem.element("MCES").getText());
                object.put("MCEE", inputItem.element("MCEE").getText());
                object.put("MCRS", inputItem.element("MCRS").getText());
                object.put("MCRE", inputItem.element("MCRE").getText());
                object.put("FCDP", inputItem.element("FCDP").getText());
                object.put("MCDP", inputItem.element("MCDP").getText());
                object.put("NMCD", inputItem.element("NMCD").getText());
                object.put("JMCD", inputItem.element("JMCD").getText());
                object.put("FLDT", inputItem.element("FLDT").getText());
                object.put("LLDT", inputItem.element("LLDT").getText());
                object.put("RWAY", inputItem.element("RWAY").getText());
                object.put("MLLT", inputItem.element("MLLT").getText());
                object.put("MFLT", inputItem.element("MFLT").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleDFltlugeftchData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltlugeftchDataInfoSrvRequest");
            Element collection = request.element("ImportDFltlugeftchDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("BTNO", inputItem.element("BTNO").getText());
                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("BTAT", inputItem.element("BTAT").getText());
                object.put("ESTR", inputItem.element("ESTR").getText());
                object.put("EEND", inputItem.element("EEND").getText());
                object.put("RSTR", inputItem.element("RSTR").getText());
                object.put("REND", inputItem.element("REND").getText());
                object.put("BTSC", inputItem.element("BTSC").getText());
                object.put("EXNO", inputItem.element("EXNO").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleDFltlugloadData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltlugloadDataInfoSrvRequest");
            Element collection = request.element("ImportDFltlugloadDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("CHNO", inputItem.element("CHNO").getText());
                object.put("ID", inputItem.element("ID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("CHAT", inputItem.element("CHAT").getText());
                object.put("ESTR", inputItem.element("ESTR").getText());
                object.put("EEND", inputItem.element("EEND").getText());
                object.put("RSTR", inputItem.element("RSTR").getText());
                object.put("REND", inputItem.element("REND").getText());
                object.put("BTSC", inputItem.element("BTSC").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleDFltshareData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltshareDataInfoSrvRequest");
            Element collection = request.element("ImportDFltshareDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("SFAW", inputItem.element("SFAW").getText());
                object.put("SFNO", inputItem.element("SFNO").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleDFltstandData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltstandDataInfoSrvRequest");
            Element collection = request.element("ImportDFltstandDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("FLID", inputItem.element("FLID").getText());
                object.put("STNO", inputItem.element("STNO").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("ESTR", inputItem.element("ESTR").getText());
                object.put("EEND", inputItem.element("EEND").getText());
                object.put("RSTR", inputItem.element("RSTR").getText());
                object.put("REND", inputItem.element("REND").getText());
                object.put("BTSC", inputItem.element("BTSC").getText());
                object.put("CSSI", inputItem.element("CSSI").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleDFltSgDynData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportDFltSgDynDataInfoSrvRequest");
            Element collection = request.element("ImportDFltSgDynDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("FLID", inputItem.element("FLID").getText());
                object.put("CODE", inputItem.element("CODE").getText());
                object.put("NAME", inputItem.element("NAME").getText());
                object.put("ESTT", inputItem.element("ESTT").getText());
                object.put("RSTT", inputItem.element("RSTT").getText());
                object.put("FTT", inputItem.element("FTT").getText());
                object.put("ORDER", inputItem.element("ORDER").getText());
                object.put("UPDATETIME", inputItem.element("UPDATETIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleFlightPassengerAndLuggageData(String data) {

        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportFlightPassengerAndLuggageDataInfoSrvRequest");
            Element collection = request.element("ImportFlightPassengerAndLuggageDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("FLID", inputItem.element("FLID").getText());
                object.put("DATA_DATE", inputItem.element("DATA_DATE").getText());
                object.put("PASS_ADNO", inputItem.element("PASS_ADNO").getText());
                object.put("PASS_CDNO", inputItem.element("PASS_CDNO").getText());
                object.put("ADNO", inputItem.element("ADNO").getText());
                object.put("CDNO", inputItem.element("CDNO").getText());
                object.put("BACKAGE_NUM", inputItem.element("BACKAGE_NUM").getText());
                object.put("BACKAGE_WEIGHT", inputItem.element("BACKAGE_WEIGHT").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleBridgeData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportBridgeDataInfoSrvRequest");
            Element collection = request.element("ImportBridgeDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("DEVICE_NAME", inputItem.element("DEVICE_NAME").getText());
                object.put("BRAND", inputItem.element("BRAND").getText());
                object.put("STAND", inputItem.element("STAND").getText());
                // 设备分组 原字段GROUP为mysql关键字, 需要修改为DEVICE_GROUP
                object.put("DEVICE_GROUP", inputItem.element("GROUP").getText());
                object.put("AREA", inputItem.element("AREA").getText());
                object.put("DEPT", inputItem.element("DEPT").getText());
                object.put("IP", inputItem.element("IP").getText());
                // 设备端口 原字段PORT为mysql关键字, 需要修改为DEVICE_PORT
                object.put("DEVICE_PORT", inputItem.element("PORT").getText());
                object.put("FMIS_ID", inputItem.element("FMIS_ID").getText());
                object.put("REMARKS", inputItem.element("REMARKS").getText());
                object.put("STA", inputItem.element("STA").getText());
                object.put("C_STA", inputItem.element("C_STA").getText());
                object.put("M_STA", inputItem.element("M_STA").getText());
                object.put("E_FLAG", inputItem.element("E_FLAG").getText());
                object.put("U_TIME", inputItem.element("U_TIME").getText());
                object.put("W_TIME", inputItem.element("W_TIME").getText());
                object.put("STA_TIME", inputItem.element("STA_TIME").getText());
                object.put("C_STA_TIME", inputItem.element("C_STA_TIME").getText());
                object.put("S_STA", inputItem.element("S_STA").getText());
                object.put("STOP_TIME", inputItem.element("STOP_TIME").getText());
                object.put("START_POWER", inputItem.element("START_POWER").getText());
                object.put("SPEED", inputItem.element("SPEED").getText());
                object.put("SLOPE", inputItem.element("SLOPE").getText());
                object.put("HEIGHT", inputItem.element("HEIGHT").getText());
                object.put("B_A", inputItem.element("B_A").getText());
                object.put("W_A", inputItem.element("W_A").getText());
                object.put("H_A", inputItem.element("H_A").getText());
                object.put("LENTH", inputItem.element("LENTH").getText());
                object.put("ERR_CODE", inputItem.element("ERR_CODE").getText());
                object.put("MSG_CODE", inputItem.element("MSG_CODE").getText());
                object.put("OPT_CODE", inputItem.element("OPT_CODE").getText());
                object.put("SEND_TIMER", inputItem.element("SEND_TIMER").getText());
                object.put("C_STA_HIS_ID", inputItem.element("C_STA_HIS_ID").getText());
                object.put("STA_HIS_ID", inputItem.element("STA_HIS_ID").getText());
                object.put("ALERT_HIS_ID", inputItem.element("ALERT_HIS_ID").getText());
                object.put("ALERT_TIME", inputItem.element("ALERT_TIME").getText());
                object.put("ENSURE_FLAG", inputItem.element("ENSURE_FLAG").getText());
                object.put("ENSURE_TIME", inputItem.element("ENSURE_TIME").getText());


                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handlePlaneAirconditionData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportPlaneAirconditionDataInfoSrvRequest");
            Element collection = request.element("ImportPlaneAirconditionDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("DEVICE_NAME", inputItem.element("DEVICE_NAME").getText());
                object.put("BRAND", inputItem.element("BRAND").getText());
                object.put("STAND", inputItem.element("STAND").getText());
                // 设备分组 原字段GROUP为mysql关键字, 需要修改为DEVICE_GROUP
                object.put("DEVICE_GROUP", inputItem.element("GROUP").getText());
                object.put("AREA", inputItem.element("AREA").getText());
                object.put("DEPT", inputItem.element("DEPT").getText());
                object.put("IP", inputItem.element("IP").getText());
                // 设备端口 原字段PORT为mysql关键字, 需要修改为DEVICE_PORT
                object.put("DEVICE_PORT", inputItem.element("PORT").getText());
                object.put("FMIS_ID", inputItem.element("FMIS_ID").getText());
                object.put("REMARKS", inputItem.element("REMARKS").getText());
                object.put("STA", inputItem.element("STA").getText());
                object.put("C_STA", inputItem.element("C_STA").getText());
                object.put("M_STA", inputItem.element("M_STA").getText());
                object.put("E_FLAG", inputItem.element("E_FLAG").getText());
                object.put("U_TIME", inputItem.element("U_TIME").getText());
                object.put("W_TIME", inputItem.element("W_TIME").getText());
                object.put("STA_TIME", inputItem.element("STA_TIME").getText());
                object.put("C_STA_TIME", inputItem.element("C_STA_TIME").getText());
                object.put("S_STA", inputItem.element("S_STA").getText());
                object.put("STOP_TIME", inputItem.element("STOP_TIME").getText());
                object.put("S_AIR", inputItem.element("S_AIR").getText());
                object.put("T_NEW", inputItem.element("T_NEW").getText());
                object.put("ST_C", inputItem.element("ST_C").getText());
                object.put("ST_H", inputItem.element("ST_H").getText());
                object.put("V_I", inputItem.element("V_I").getText());
                object.put("I_I", inputItem.element("I_I").getText());
                object.put("S_PL", inputItem.element("S_PL").getText());
                object.put("ERR_CODE", inputItem.element("ERR_CODE").getText());
                object.put("MSG_CODE", inputItem.element("MSG_CODE").getText());
                object.put("C_STA_HIS_ID", inputItem.element("C_STA_HIS_ID").getText());
                object.put("STA_HIS_ID", inputItem.element("STA_HIS_ID").getText());
                object.put("ALERT_HIS_ID", inputItem.element("ALERT_HIS_ID").getText());
                object.put("ALERT_TIME", inputItem.element("ALERT_TIME").getText());
                object.put("ENSURE_FLAG", inputItem.element("ENSURE_FLAG").getText());
                object.put("ENSURE_TIME", inputItem.element("ENSURE_TIME").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handlePowerInfoData(String data) {

        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportPowerInfoDataInfoSrvRequest");
            Element collection = request.element("ImportPowerInfoDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("DEVICE_NAME", inputItem.element("DEVICE_NAME").getText());
                object.put("BRAND", inputItem.element("BRAND").getText());
                object.put("STAND", inputItem.element("STAND").getText());
                // 设备分组 原字段GROUP为mysql关键字, 需要修改为DEVICE_GROUP
                object.put("DEVICE_GROUP", inputItem.element("GROUP").getText());
                object.put("AREA", inputItem.element("AREA").getText());
                object.put("DEPT", inputItem.element("DEPT").getText());
                object.put("IP", inputItem.element("IP").getText());
                // 设备端口 原字段PORT为mysql关键字, 需要修改为DEVICE_PORT
                object.put("DEVICE_PORT", inputItem.element("PORT").getText());
                object.put("FMIS_ID", inputItem.element("FMIS_ID").getText());
                object.put("REMARKS", inputItem.element("REMARKS").getText());
                object.put("STA", inputItem.element("STA").getText());
                object.put("C_STA", inputItem.element("C_STA").getText());
                object.put("M_STA", inputItem.element("M_STA").getText());
                object.put("E_FLAG", inputItem.element("E_FLAG").getText());
                object.put("U_TIME", inputItem.element("U_TIME").getText());
                object.put("W_TIME", inputItem.element("W_TIME").getText());
                object.put("STA_TIME", inputItem.element("STA_TIME").getText());
                object.put("C_STA_TIME", inputItem.element("C_STA_TIME").getText());
                object.put("S_STA", inputItem.element("S_STA").getText());
                object.put("STOP_TIME", inputItem.element("STOP_TIME").getText());
                object.put("START_POWER", inputItem.element("START_POWER").getText());
                object.put("FREQ_I", inputItem.element("FREQ_I").getText());
                object.put("FREQ_O", inputItem.element("FREQ_O").getText());
                object.put("VDC_M", inputItem.element("VDC_M").getText());
                object.put("V_O", inputItem.element("V_O").getText());
                object.put("V_AV_L", inputItem.element("V_AV_L").getText());
                object.put("P_ALL", inputItem.element("P_ALL").getText());
                object.put("S_ALL", inputItem.element("S_ALL").getText());
                object.put("T_M_1", inputItem.element("T_M_1").getText());
                object.put("T_M_2", inputItem.element("T_M_2").getText());
                object.put("RUN_H", inputItem.element("RUN_H").getText());
                object.put("RUN_MI", inputItem.element("RUN_MI").getText());
                object.put("RUN_S", inputItem.element("RUN_S").getText());
                object.put("P_MW", inputItem.element("P_MW").getText());
                object.put("P_KW", inputItem.element("P_KW").getText());
                object.put("P_W", inputItem.element("P_W").getText());
                object.put("V_AV", inputItem.element("V_AV").getText());
                object.put("I_AV", inputItem.element("I_AV").getText());
                object.put("P_TOTAL", inputItem.element("P_TOTAL").getText());
                object.put("ERR_CODE", inputItem.element("ERR_CODE").getText());
                object.put("SEND_TIMER", inputItem.element("SEND_TIMER").getText());
                object.put("C_STA_HIS_ID", inputItem.element("C_STA_HIS_ID").getText());
                object.put("STA_HIS_ID", inputItem.element("STA_HIS_ID").getText());
                object.put("ALERT_HIS_ID", inputItem.element("ALERT_HIS_ID").getText());
                object.put("ALERT_TIME", inputItem.element("ALERT_TIME").getText());
                object.put("ENSURE_FLAG", inputItem.element("ENSURE_FLAG").getText());
                object.put("ENSURE_TIME", inputItem.element("ENSURE_TIME").getText());


                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }

    public static List<Map<String, String>> handleScheduleFlightData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportScheduleFlightDataInfoSrvRequest");
            Element collection = request.element("ImportScheduleFlightDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("FLIGHTNO", inputItem.element("FLIGHTNO").getText());
                object.put("ISOFFIN", inputItem.element("ISOFFIN").getText());
                object.put("TASK", inputItem.element("TASK").getText());
                object.put("ATTRIBUTE", inputItem.element("ATTRIBUTE").getText());
                object.put("CRAFTTYPEID", inputItem.element("CRAFTTYPEID").getText());
                object.put("STARTSTATIONID", inputItem.element("STARTSTATIONID").getText());
                object.put("STARTSCHEMETAKEOFFTIME", inputItem.element("STARTSCHEMETAKEOFFTIME").getText());
                object.put("TERMINALSTATIONID", inputItem.element("TERMINALSTATIONID").getText());
                object.put("TERMINALSCHEMELANDINTIME", inputItem.element("TERMINALSCHEMELANDINTIME").getText());
                object.put("EXECMON", inputItem.element("EXECMON").getText());
                object.put("EXECTUE", inputItem.element("EXECTUE").getText());
                object.put("EXECWED", inputItem.element("EXECWED").getText());
                object.put("EXECTHU", inputItem.element("EXECTHU").getText());
                object.put("EXECFRI", inputItem.element("EXECFRI").getText());
                object.put("EXECSAT", inputItem.element("EXECSAT").getText());
                object.put("EXECSUN", inputItem.element("EXECSUN").getText());
                object.put("OVERWEEKS", inputItem.element("OVERWEEKS").getText());
                object.put("MEMO", inputItem.element("MEMO").getText());
                object.put("STARTTIME", inputItem.element("STARTTIME").getText());
                object.put("ENDTIME", inputItem.element("ENDTIME").getText());
                object.put("TERMINAL", inputItem.element("TERMINAL").getText());
                object.put("SEASON", inputItem.element("SEASON").getText());
                object.put("ISVIRTUAL", inputItem.element("ISVIRTUAL").getText());
                object.put("MAJORFLIGHTID", inputItem.element("MAJORFLIGHTID").getText());
                object.put("VIRTUALORDER", inputItem.element("VIRTUALORDER").getText());
                object.put("SEASONID", inputItem.element("SEASONID").getText());

                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }

    }

    public static List<Map<String, String>> handleTemporaryFlightData(String data) {
        List<Map<String, String>> lst = new ArrayList<>();
        try {
            Document doc = DocumentHelper.parseText(data);
            Element root = doc.getRootElement();
            Element body = root.element("Body");
            Element request = body.element("ImportTemporaryFlightDataInfoSrvRequest");
            Element collection = request.element("ImportTemporaryFlightDataInfoSrvInputCollection");
            List<Element> items = collection.elements();
            for (Element inputItem : items) {
                Map<String, String> object = new HashMap<>();

                object.put("ID", inputItem.element("ID").getText());
                object.put("AIRLINESID", inputItem.element("AIRLINESID").getText());
                object.put("FLIGHTNO", inputItem.element("FLIGHTNO").getText());
                object.put("ISOFFIN", inputItem.element("ISOFFIN").getText());
                object.put("TASK", inputItem.element("TASK").getText());
                object.put("ATTRIBUTE", inputItem.element("ATTRIBUTE").getText());
                object.put("CRAFTTYPEID", inputItem.element("CRAFTTYPEID").getText());
                object.put("STARTSTATIONID", inputItem.element("STARTSTATIONID").getText());
                object.put("STARTSCHEMETAKEOFFTIME", inputItem.element("STARTSCHEMETAKEOFFTIME").getText());
                object.put("TERMINALSTATIONID", inputItem.element("TERMINALSTATIONID").getText());
                object.put("TERMINALSCHEMELANDINTIME", inputItem.element("TERMINALSCHEMELANDINTIME").getText());
                object.put("MEMO", inputItem.element("MEMO").getText());
                object.put("TERMINAL", inputItem.element("TERMINAL").getText());
                object.put("ISVIRTUAL", inputItem.element("ISVIRTUAL").getText());
                object.put("MAJORFLIGHTID", inputItem.element("MAJORFLIGHTID").getText());
                object.put("VIRTUALORDER", inputItem.element("VIRTUALORDER").getText());
                object.put("ASSOCIATEDFLIGHTID", inputItem.element("ASSOCIATEDFLIGHTID").getText());
                object.put("EXECDATES", inputItem.element("EXECDATES").getText());
                object.put("STARTTIME", inputItem.element("STARTTIME").getText());
                object.put("ENDTIME", inputItem.element("ENDTIME").getText());
                object.put("EXECMON", inputItem.element("EXECMON").getText());
                object.put("EXECTUE", inputItem.element("EXECTUE").getText());
                object.put("EXECWED", inputItem.element("EXECWED").getText());
                object.put("EXECTHU", inputItem.element("EXECTHU").getText());
                object.put("EXECFRI", inputItem.element("EXECFRI").getText());
                object.put("EXECSAT", inputItem.element("EXECSAT").getText());
                object.put("EXECSUN", inputItem.element("EXECSUN").getText());


                lst.add(object);
            }
            return lst;

        } catch (Exception e) {
            return Collections.emptyList();
        }
    }


}
